<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="common::common(title='基础数据')">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" ></meta>
</head>
<style type="text/css">
 	iframe{
		width:100%;
		height:100%;
	}
	.urlDialog .el-dialog__header{
		padding:0;
	}
	.urlDialog .el-dialog__body{
		width:90%;
		height:100%;
	}
	.userSelectDialog{
		width:85%;
		height:75%;
	}
	.userSelectDialog .el-dialog__body{
		width:90%;
		height:60%;
	}
</style>
<script type="text/javascript" th:src="@{/js/basic/groupInfo.js}"></script>
<body>
<div id="app">
  <el-container style="margin-top:10px;">
	<el-header>
	    	<el-form ref="form" :model="queryData" label-width="80px">
		    	<el-row :gutter="20">
				  <el-col :span="6">
				  		<el-form-item label="名称">
					  		<el-input  placeholder="请输入名称" v-model="queryData.name" clearable>
							</el-input>
						</el-form-item>
				  </el-col>
				  <el-col :span="6">
				  		<el-form-item label="描述">
					  		<el-input placeholder="请输入描述" v-model="queryData.description" clearable>
							</el-input>
						</el-form-item>
				  </el-col>
				  <el-col :span="6">
				  	<el-button type="primary" icon="el-icon-search" @click="query">查询</el-button>
				  </el-col>
				</el-row>
	    	</el-form>
	    </el-header>
	    <el-main style="padding:5px;">
	    	<div style="margin:10px">
				<el-button type="primary" size="medium" icon="el-icon-plus" @click="addItem">增加</el-button>
	    		<el-button type="primary" size="medium" icon="el-icon-edit" @click="editItem">编辑</el-button>
				<el-button type="primary" size="medium" icon="el-icon-delete" @click="deleteItem">删除</el-button>
	    	</div>
	    	<div style="margin:10px;">
	    	  <el-table  
	    	    ref="groupInfoDatagrid" 
	    	    :data="datagrid"
			    tooltip-effect="dark"
			    style="width: 100%;"
			    max-height="300"
			    @row-click="datagridSelect"
			    border
			    highlight-current-row
			    >
			    <el-table-column type="index" width="30"></el-table-column>
				    <el-table-column prop="id" label="ID" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="name" label="组名" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="description" label="组描述" show-overflow-tooltip> </el-table-column>
			        <el-table-column label="操作">
				      <template slot-scope="scope">
				        <el-button
				          size="mini"
				          type="danger"
				          @click="handleGroupUser(scope.$index, scope.row)">管理组内用户</el-button>
				        <el-button
				          size="mini"
				          type="danger"
				          @click="handleGroupRole(scope.$index, scope.row)">管理组内角色</el-button>
				      </template>
				    </el-table-column>
			  </el-table>
			</div>
			<div style="margin:10px">
			    <el-pagination
			      :current-page="queryData.page"
			      :page-sizes="[10, 20, 40, 100]"
			      :page-size="queryData.rows"
			      layout="total, sizes, prev, pager, next, jumper"
			      :total="totalNum"
			      @size-change="handleSizeChange"
			      @current-change="handleCurrentChange"
			      @prev-click="handlePrevClick"
			      @next-click="handleNextClick">
			    </el-pagination>
			 </div>
	    </el-main>
	</el-container>
	<!-- dialog 开始 不需要【删除】 -->
	<el-dialog :visible.sync="dialogConfig.dialogFormVisible" top="1vh" :close-on-click-modal="false" :show-close="false">
		  <el-form :model="addData" ref="dialogForm" :rules="rules">
	      	<el-form-item label="组名" prop="name" 
	      		:label-width="dialogConfig.formLabelWidth">
		      <el-input v-model="addData.name"  auto-complete="off" style="width:220px;"></el-input>
		    </el-form-item>
	      	<el-form-item label="组描述" prop="description" 
	      		:label-width="dialogConfig.formLabelWidth">
		      <el-input v-model="addData.description"  auto-complete="off" style="width:220px;"></el-input>
		    </el-form-item>
		  </el-form>
		  <div slot="footer" class="dialog-footer">
		    <el-button @click="closeDialog">取 消</el-button>
		    <el-button type="primary" @click="submitForm('dialogForm')">确 定</el-button>
		  </div>
	 </el-dialog>
	 <!-- dialog 结束 -->
	 <el-dialog :visible.sync="dialogConfig.urlDialogVisible" custom-class="urlDialog" :close-on-click-modal="false" :show-close="false" fullscreen center>
	 	<iframe name="groupinfoFrame" :src='urlDialogContent' frameborder="0" scrolling="yes" style="width:100%;height:100%;"></iframe>
	 </el-dialog>
 	 <el-dialog :visible.sync="dialogConfig.userSelectDialogVisible" custom-class="userSelectDialog">
	 	<iframe name="userinfoFrame" :src='userSelectDialogUrl' frameborder="0" scrolling="yes" style="width:100%;height:100%;"></iframe>
	 	<div slot="footer" class="dialog-footer">
		    <el-button type="primary" @click="doSelectUser">确 定</el-button>
		 </div>
	 </el-dialog>
</div>
</body>
</html>